
#pragma once

namespace System
{

#define DEFAULT_SIZE 4
		//template <class T>
	class SYSTEM_API MemoryBuffer
	{
	public:
		MemoryBuffer(size_t m_capacity = DEFAULT_SIZE);
		MemoryBuffer(const byte* src, size_t size);
		MemoryBuffer(const char* src);
		//copy constructor
		MemoryBuffer(const MemoryBuffer& copy);
		
		virtual ~MemoryBuffer(void);
	
		byte&	operator[](size_t index) ;
		byte	operator[](size_t index) const;
		MemoryBuffer& operator=(const MemoryBuffer &rhs);
		
		size_t	size(size_t offset = 0) const;
		byte*	getData(size_t offset = 0) const;
		void	addData(const MemoryBuffer& buffer, size_t destOff = 0, size_t crtOff = 0);
		void	addData(byte* bytes, size_t bufSize, size_t destOff = 0, size_t crtOff = 0);
	    void	addData(LPCWSTR bytes, size_t bufSize, size_t destOff = 0, size_t crtOff = 0);
		void	updateSize(size_t bufSize, size_t destOff = 0, size_t crtOff = 0);
	public:
		bool	startsWith (const MemoryBuffer& mem) const;
	private:
		void		updateCapacity(size_t newCap); 
		void		updateCapacity(void); 
		byte*		m_data;
		size_t		m_size;
		size_t  	m_capacity;
	};

//template class  __declspec(dllexport) MemotyBuffer
//	<int>;

}